package com.lemon.core.captcha.config;

import com.lemon.core.captcha.service.ImageCaptchaService;
import com.lemon.core.captcha.service.impl.ImageCaptchaServiceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;

/**
 * 图片验证码自动配置
 *
 * @author pan
 * @since 2018-04-16
 */
@Configuration
public class ImageCaptchaAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean(ImageCaptchaService.class)
    public ImageCaptchaService imageCaptchaService(StringRedisTemplate stringRedisTemplate) {
        return new ImageCaptchaServiceImpl(stringRedisTemplate);
    }
}
